﻿<?xml version="1.0" encoding="utf-8" ?>

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly ="monitor_2_DBwork" namespace ="monitor_2_DBwork" >
  <class name="RTPS" table="Stations" >
    <id name ="Id" column ="Id" type ="int" generator="identity" />
    <property name="Idobl" column="Idobl" type="int"/>
    <property name="Idblr" column="Idblr" type="int"/>    
    <property name="Name" column="Name" type="string" unique="true"/>
    <property name="Coordinates" column="Coordinates" type="string(16)" />

    <many-to-one name="Oblast" class="Oblast" column="Idobl" lazy="false"
                 cascade="save-update" insert="false" update="false" not-null="false"/>

    <many-to-one name="BLR" class="BLR" column="Idblr" lazy="false"
                 cascade="save-update" insert="false" update="false" not-null="false"/>

    <set name="DeviceList" inverse="true" cascade="all-delete-orphan" lazy="false">
      <key column="Idrtps" not-null="true"/>
      <one-to-many class="Devices"/>
    </set> 
    
  </class>
</hibernate-mapping>